<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                template="/templates/template.xhtml">
    <ui:define name="title">用户信息</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="保存" icon="fa fa-save"
                                         actionListener="#{systemUserSettingBean.onSaveUserInfo}"
                                         rendered="#{systemUserSettingBean.activeIndex == 0}"
                                         update="@form"/>

                        <p:commandButton value="修改密码" icon="fa fa-save"
                                         actionListener="#{systemUserSettingBean.onChangePassword}"
                                         rendered="#{systemUserSettingBean.activeIndex == 1}"
                                         update="@form"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <p:tabView id="userSettingTabView" scrollable="true"
                                       activeIndex="#{systemUserSettingBean.activeIndex}">
                                <p:ajax event="tabChange" update="@form"/>
                                <p:tab title="用户信息" id="systemUserInfo">
                                    <div class="ui-g">
                                        <div class="ui-g-2">
                                            <p:outputLabel for="name" value="姓名"/>
                                        </div>
                                        <div class="ui-g-4">
                                            <p:inputText id="name" value="#{systemUserSettingBean.loginUser.name}"/>
                                        </div>
                                        <div class="ui-g-2">
                                            <p:outputLabel for="partner" value="所属机构"/>
                                        </div>
                                        <div class="ui-g-4">
                                            <p:inputText id="partner"
                                                         value="#{systemUserSettingBean.loginUser.partner.name}"
                                                         disabled="true"/>
                                        </div>
                                        <div class="ui-g-2">
                                            <p:outputLabel for="email" value="邮箱"/>
                                        </div>
                                        <div class="ui-g-4">
                                            <p:inputText id="email" value="#{systemUserSettingBean.loginUser.email}"/>
                                        </div>
                                        <div class="ui-g-2">
                                            <p:outputLabel for="phone" value="联系电话"/>
                                        </div>
                                        <div class="ui-g-4">
                                            <p:inputText id="phone" value="#{systemUserSettingBean.loginUser.phone}"/>
                                        </div>
                                    </div>
                                </p:tab>
                                <p:tab title="修改密码" id="changePasswordTab">
                                    <div class="ui-g">
                                        <div class="ui-g-2">
                                            <p:outputLabel value="原密码"/>
                                        </div>
                                        <div class="ui-g-4">
                                            <p:password feedback="true" autocomplete="true"
                                                        value="#{systemUserSettingBean.oldPassword}" strongLabel="强"
                                                        weakLabel="弱"
                                                        goodLabel="中" promptLabel="请输入密码"/>
                                        </div>
                                        <div class="ui-g-6"/>
                                        <div class="ui-g-2">
                                            <p:outputLabel value="新密码"/>
                                        </div>
                                        <div class="ui-g-4">
                                            <p:password feedback="true" autocomplete="true"
                                                        value="#{systemUserSettingBean.newPassword}" strongLabel="强"
                                                        weakLabel="弱"
                                                        goodLabel="中" promptLabel="请输入密码"/>
                                        </div>
                                        <div class="ui-g-6"/>
                                        <div class="ui-g-2">
                                            <p:outputLabel value="确认新密码"/>
                                        </div>
                                        <div class="ui-g-4">
                                            <p:password feedback="true" autocomplete="true"
                                                        value="#{systemUserSettingBean.confirmPassword}" strongLabel="强"
                                                        weakLabel="弱"
                                                        goodLabel="中" promptLabel="请输入密码"/>
                                        </div>
                                    </div>
                                </p:tab>
                            </p:tabView>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>